package com.zxj.geekstudy;

import com.zxjtest.start.GeekStudySpringBootStartApplication;
import com.zxjtest.start.TestAnnotation;
import com.zxjtest.start.TestAutoConfiguration;
import com.zxjtest.start.prop.TestPropertiesConfiguration;
import com.zxjtest.start.spring02.Klass;
import com.zxjtest.start.spring02.Student;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import com.zxjtest.start.spring02.School;

import java.util.Map;

@SpringBootApplication(scanBasePackages = "com.zxj")
public class TestSpringBootApplication {

    public static void main(String[] args) {
        ConfigurableApplicationContext applicationContext = SpringApplication.run(TestSpringBootApplication.class, args);
        System.out.println(String.join(",", applicationContext.getBeanDefinitionNames()));
        School school = applicationContext.getBean(School.class);
        school.ding();
        Klass klass = applicationContext.getBean(Klass.class);
        klass.dong();
        Map map = applicationContext.getBeansOfType(Student.class);
        System.out.println(map);

        TestAutoConfiguration testAutoConfiguration = applicationContext.getBean(TestAutoConfiguration.class);
        System.out.println(testAutoConfiguration);

        TestPropertiesConfiguration testPropertiesConfiguration = applicationContext.getBean(TestPropertiesConfiguration.class);
        System.out.println(testPropertiesConfiguration);

        TestAnnotation testAnnotation = applicationContext.getBean(TestAnnotation.class);
        System.out.println(testAnnotation);
    }

}
